Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

143
Vistas
Automatically wrap "div class" around table inside TinyMCE 5

I'm using the TinyMCE 5 editor.

Now I'm trying to find a solution so the editor automatically wraps a table with a certain "div container".

I tried it like that:

tinyMCE.init({
    selector: '#myTextarea',
    plugins: 'table code autolink link lists charmap print preview textcolor code',
    toolbar: 'table code link | undo redo | insert | code',
    menubar: false,
    min_height: 300,
    setup: function (ed) {
       ed.on("keyup", function () {
                var contentmain = tinymce.activeEditor.getContent();
                $('#preview').html(contentmain);
        });
        ed.on("keyup", function () {
            $('.tabledefaultg').wrap('<div class="scroll-bar"></div>');
        });
    }
});

The problem is that <div class="scroll-bar"> doesn't get added inside the editors' source code. It just gets added inside the "preview" container.

How can I fix this problem?

This is the JSFiddle.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda